  <?php
include 'class_sql.php';
include '../web_inc.php';
include ROOT_PATH.'/config/db_conn.php';


$list = new mysql_Class();
$table="gy_class";       //分类表：供应

	    $class_arr=array();
		$query = mysql_query("select * from $table order by sort asc, id Desc");
		while($row =mysql_fetch_array($query)){
			$class_arr[] = array($row['id'],$row['name'],$row['up'],$row['sort']);
		}


?>
<select name="up" id="up">
<?php

dafenglei_select(0,0,'4');
?>
</select>
<?php






function dafenglei_select($m,$id,$index)
{	
	global $class_arr;
	$n = str_pad('',$m,'-',STR_PAD_RIGHT);
	$n = str_replace("-","&nbsp;&nbsp;",$n);
	for($i=0;$i<count($class_arr);$i++){
	
		if($class_arr[$i][2]==$id){
			if($class_arr[$i][0]==$index){
				echo "        <option value=\"".$class_arr[$i][0]."\" selected=\"selected\">".$n."|--".$class_arr[$i][1]."</option>\n";
			}else{
				echo "        <option value=\"".$class_arr[$i][0]."\">".$n."|--".$class_arr[$i][1]."</option>\n";
			}
			dafenglei_select($m+1,$class_arr[$i][0],$index);
			
		}
		
	}
	
}